/*
 * Author: vdaras
 */


#ifndef STATESTACK_H
#define	STATESTACK_H

#include "NonCopyable.h"

#include <stack>

class State;

class StateStack : public NonCopyable
{
private:
    std::stack< State* > m_states;
    
    bool m_mustPop;

public:
    StateStack();

    ~StateStack();

    /**
     * Pushes a State to the stack.
     *
     * @param toPush
     */

    void Push(State* toPush);


    /**
     * Pops top State from the Stack.
     */

    void Pop();


    /**
     * Notify the StateStack that the top state must be popped when it's appropriate.
     */
    
    void SafePop();
    
    
    /**
     * Returns if the Stack should pop its top or not.
     */
    
    inline bool MustPop()
    {
	return m_mustPop;
    }
    
    
    /**
     * @return a pointer to the State at the top of the Stack.
     */

    State* Top() const;


    /**
     * @return Count of States in stack.
     */

    unsigned int Size() const;
};

#endif	/* STATESTACK_H */

